/**
 * Copyright 2020 (c) Felix Palmer
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */
uniform float uFogDropoff;
uniform float uFogIntensity;
uniform vec3 uFogColor;

float fogFactor( in float dist ) {
  float fog = uFogIntensity *  ( 1.0 - exp( -dist * uFogDropoff ) );
  return clamp( fog, 0.0, 1.0 );
}

float fogFactor( in vec3 camera, in vec3 pos ) {
  float dist = distance( camera, pos );
  return fogFactor( dist );
}
